<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        ul {
            list-style: none;
        }

        div {
            width: 1200px;
            height: 300px;
            margin: 50px auto;
            border: 1px solid red;
            overflow: hidden;
        }

        div li {
            width: 240px;
            height: 300px;
            float: left;
            transition: all 500ms;
        }

        div ul {
            width: 1200px;
        }

        img {
            height: 300px;
            width: 800px;
        }
    </style>
</head>

<body>
    <div class="box">
        <ul>
            <li>
                <a href="#">
                    <img src="/imgs/timthumb(1).jpg" alt="">
                </a>
            </li>
            <li>
                <a href="#">
                    <img src="/imgs/timthumb(2).jpg" alt="">
                </a>
            </li>
            <li>
                <a href="#">
                    <img src="/imgs/timthumb(3).jpg" alt="">
                </a>
            </li>
            <li>
                <a href="#">
                    <img src="/imgs/timthumb(4).jpg" alt="">
                </a>
            </li>
            <li>
                <a href="#">
                    <img src="/imgs/timthumb(2).jpg" alt="">
                </a>
            </li>
        </ul>
    </div>
    <script>
        let lis = document.querySelectorAll('li')
        for (let i = 0; i < lis.length; i++) {
            lis[i].addEventListener('mouseenter', function () {
                for (let j = 0; j < lis.length; j++) {
                    lis[j].style.width = '100px'
                }
                this.style.width = '800px'
            })
            lis[i].addEventListener('mouseleave', function () {
                for (let j = 0; j < lis.length; j++) {
                    lis[j].style.width = '300px'
                }
            })
        }
    </script>
</body>

</html>